package com.kingyea.mobilepolice.orgjobcategory.controller;

import com.kingyea.mobilepolice.orgjobcategory.bean.OrgDictionaryJobCategory;
import com.kingyea.mobilepolice.orgjobcategory.service.OrgDictionaryJobCategoryService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Mr.Lin
 * @version v1.0.0
 * @description OrgDictionaryJobCategory 控制层
 * @date Created in 2018-04-26 15:24:48
 */
@RequestMapping(value = "/orgDictionaryJobCategory")
@RestController
public class OrgDictionaryJobCategoryController {

    private static final Logger LOGGER = LoggerFactory.getLogger(OrgDictionaryJobCategoryController.class);

    @Autowired
    private OrgDictionaryJobCategoryService orgDictionaryJobCategoryService;

    /**
     * 查询全部
     *
     * @param
     * @return
     */
    @RequestMapping(method = RequestMethod.GET)
    public List<OrgDictionaryJobCategory> list() {
        return orgDictionaryJobCategoryService.search(null);
    }

    /**
     * 创建
     *
     * @param orgDictionaryJobCategory
     * @return
     */
    @RequestMapping(method = RequestMethod.POST)
    public Object create(@RequestBody OrgDictionaryJobCategory orgDictionaryJobCategory) throws Exception {
        return orgDictionaryJobCategoryService.save(orgDictionaryJobCategory);
    }

    /**
     * 删除
     *
     * @return
     */
    @RequestMapping(value = "", method = RequestMethod.DELETE)
    public Object delete(String orgSerialNo) {
        return orgDictionaryJobCategoryService.deleteByOrgSerialNo(orgSerialNo);
    }

}
